package com.wing.cabinet.model.entity;

import java.io.Serializable;

import com.alibaba.cloud.commons.lang.StringUtils;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 盘验结果表
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("cab_checked_result_label")
public class CheckedResultLabel extends BaseEntity<CheckedResultLabel> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum OperationType implements IEnum<Integer> {

        /**
        * 存刀
        */
        in(1,"存刀"),
        /**
        * 取刀
        */
        out(2,"取刀");

        private int code;
        private String desc;

        OperationType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum BusinessType implements IEnum<Integer> {

        /**
        * 暂存
        */
        temp(1,"暂存"),
        /**
        * 维修
        */
        repair(2,"维修"),
        /**
        * 回收
        */
        recycle(3,"回收");

        private int code;
        private String desc;

        BusinessType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }

        @JsonCreator
        public static BusinessType jsonCreator(String name) {
            if (StringUtils.isNotBlank(name)) {
                for (BusinessType item : values()) {
                    if (item.name().equals(name.trim())) {
                        return item;
                    }
                }
            }
            return null;
        }
    }

    public enum BusinessTypeChecked implements IEnum<Integer> {
        losed(0,"缺失"),
        /**
        * 暂存
        */
        temp(1,"暂存"),
        /**
        * 维修
        */
        repair(2,"维修"),
        /**
        * 回收
        */
        recycle(3,"回收");

        private int code;
        private String desc;

        BusinessTypeChecked(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }

        @JsonCreator
        public static BusinessTypeChecked jsonCreator(String name) {
            if (StringUtils.isNotBlank(name)) {
                for (BusinessTypeChecked item : values()) {
                    if (item.name().equals(name.trim())) {
                        return item;
                    }
                }
            }
            return null;
        }
    }
    /**
     * 渠道编号
     */
    private String channelCode;
    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 盘验结果id
     */
    private Long resultId;

    /**
     * 盘验结果id
     */
    private Long resultDetailId;

    /**
     * 暂存/回收/维修任务id
     */
    private Long storageInoutId;

    /**
     * 条码
     */
    private String labelCode;

    /**
     * 是否同步
     */
    private Boolean isSync;

    /**
     * 柜子id
     */
    private Long cabId;

    /**
     * sku id
     */
    private Long skuId;

    /**
     * 数量
     */
    private Integer quantity;

    /**
     * 基础单位数量
     */
    private Integer quantityPack;

    /**
     * 企业id
     */
    private Long companyId;

    /**
     * 操作类型
     */
    private OperationType operationType;

    /**
    * 操作类型描述
    */
    @TableField(exist = false)
    private String operationTypeDesc;

    public String getOperationTypeDesc() {
        return operationType == null ? null : operationType.getDesc();
    }

    /**
     * 业务类型
     */
    private BusinessType businessType;

    /**
    * 业务类型描述
    */
    @TableField(exist = false)
    private String businessTypeDesc;

    public String getBusinessTypeDesc() {
        return businessType == null ? null : businessType.getDesc();
    }

    /**
     * 柜子编号
     */
    private String cabCode;

    /**
     * sku 编号
     */
    private String skuCode;

    /**
     * 货道编号
     */
    private String spaceCode;

    /**
     * operationTypeChecked
     */
    private Integer operationTypeChecked;

    /**
     * 业务类型
     */
    private BusinessTypeChecked businessTypeChecked;

    /**
    * 业务类型描述
    */
    @TableField(exist = false)
    private String businessTypeCheckedDesc;

    public String getBusinessTypeCheckedDesc() {
        return businessTypeChecked == null ? null : businessTypeChecked.getDesc();
    }

    /**
     * quantityCurrentChecked
     */
    private Integer quantityCurrentChecked;

    /**
     * quantityAfterChecked
     */
    private Integer quantityAfterChecked;

    /**
     * repairPrice
     */
    private BigDecimal repairPrice;

    /**
     * 签收数量
     */
    private Integer quantitySign;

    /**
     * 是否已同步：no(0,未同步);yes(1,已同步);
     */
    private Integer isSyns;

    /**
    * 同步时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime synsTime;

    /**
     * 货道id
     */
    private Long spaceId;

    /**
     * quantityChecked
     */
    private Integer quantityChecked;

    /**
     * 企业编码
     */
    private String enterpriseCode;

    private Boolean isCorrect;

    private String inCreatorName;

    private String inCreatorImg;

    private BigDecimal price;
    /**
     * 机台
     */
    private String  deviceCode;
    /**
     * 工单id
     */
    private Long workOrderId;

}
